package com.wandian.game
{
	import com.wandian.utils.SWFProfiler;

	import flash.display.Sprite;
	import flash.events.Event;
	import flash.system.Security;
	import flash.text.TextField;
	import flash.utils.getQualifiedClassName;
	import flash.utils.getTimer;

	import com.wandian.ui.controls.TabContent;
	import com.wandian.ui.controls.Button;
	import com.wandian.ui.controls.Label;
	import com.wandian.ui.controls.LabelButton;
	import com.wandian.ui.controls.List;
	import com.wandian.ui.controls.ScrollBar;
	import com.wandian.ui.controls.Tab;
	import com.wandian.ui.controls.TabNavigator;
	import com.wandian.ui.controls.TextInput;
	import com.wandian.ui.controls.ToggleButton;
	import com.wandian.ui.controls.UIComponent;
	import com.wandian.ui.controls.UIManager;
	import com.wandian.ui.events.ScrollBarEvent;
	import com.wandian.ui.skins.ButtonSkin;
	import com.wandian.ui.skins.LabelSkin;
	import com.wandian.ui.skins.ScrollArrowSkin;
	import com.wandian.ui.skins.ScrollBarSkin;
	import com.wandian.ui.skins.ScrollThumbSkin;
	import com.wandian.ui.skins.TabSkin;
	import com.wandian.ui.skins.TextInputSkin;
	import com.wandian.ui.controls.ClassStyleDeclaration;
	import com.wandian.ui.controls.StyleDeclaration;
 

	public class Bootstrap extends Sprite
	{
		private var manager:UIManager

		public function Bootstrap()
		{
			//SWFProfiler.init(stage, this);
            //在系统启动的时候，加载控件样式
			UIManager.initialize(this.stage);
			manager=UIManager.getInstance()
			var csd:ClassStyleDeclaration=setClassStyleDeclaration(UIComponent, {themeColor: 0x009DFF, fontFamily: "Verdana", fontSize: 12, textColor: 0x0B333C, textRollOverColor: 0x2B333C, textSelectedColor: 0x2B333C, textAlign: "left", cornerRadius: 4, focusColor: 0xFF0000})
			setClassStyleDeclaration(Label, {skin: LabelSkin})
			setClassStyleDeclaration(Button, {borderColor: 0xB7BABC, cornerRadius: 4, fillAlphas: [0.6, 0.4, 0.75, 0.65], fillColors: [0xFFFFFF, 0xCCCCCC, 0xFFFFFF, 0xEEEEEE, 0xD8F0FF, 0x99D7FF], fontWeight: "bold", textAlign: "center", skin: ButtonSkin, highlightAlphas: [0.3, 0]})

			setClassStyleDeclaration(ScrollBar, {borderColor: 0xB7BABC, skin: ScrollBarSkin, upArrowStyle: new StyleDeclaration({skin: ScrollArrowSkin, arrowColor: 0x111111}), downArrowStyle: new StyleDeclaration({skin: ScrollArrowSkin, arrowColor: 0x111111}), ScrollThumbStyle: new StyleDeclaration({skin: ScrollThumbSkin, arrowColor: 0x111111}), trackColors: [0x94999b, 0xe7e7e7], backgroundColor: 0xFFFFFF, cornerRadius: 0})

			setClassStyleDeclaration(TextInput, {borderColor: 0xB7BABC, skin: TextInputSkin, backgroundColor: 0xFFFFFF, cornerRadius: 5, focusColor: 0xFF0000})

			setClassStyleDeclaration(TabNavigator, {tabSpace: 2, tabSkin: TabSkin})
			csd.notifyChildren("fixParentStylesRef");

			Security.allowDomain("*");
			onStart();

		}

		protected function onStart():void
		{

		}

		public function setClassStyleDeclaration(_class:Class, factory:Object):ClassStyleDeclaration
		{
			var csd:ClassStyleDeclaration=manager.getClassStyleDeclaration(getQualifiedClassName(_class), false)
			csd.factory(factory)
			return csd;
		}
	}
}
